package cn.denvie.agent.model;

import java.util.ArrayList;

public class JdbcStatistics extends BaseStatistics {

    private Long begin;
    private Long end;
    private Long useTime;
    // jdbc url
    private String jdbcUrl;
    // sql 语句
    private String sql;
    // 数据库名称
    private String databaseName;

    private String error;
    private String errorType;

    // 是否经过预处理
    private boolean prepared;
    // 收集SQL执行参数
    private ArrayList<ParamValues> params = new ArrayList();

    public void addParam(ParamValues pv) {
        if (pv != null) {
            params.add(pv);
        }
    }

    public Long getBegin() {
        return begin;
    }

    public void setBegin(Long begin) {
        this.begin = begin;
    }

    public Long getEnd() {
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }

    public Long getUseTime() {
        return useTime;
    }

    public void setUseTime(Long useTime) {
        this.useTime = useTime;
    }

    public String getJdbcUrl() {
        return jdbcUrl;
    }

    public void setJdbcUrl(String jdbcUrl) {
        this.jdbcUrl = jdbcUrl;
    }

    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public String getDatabaseName() {
        return databaseName;
    }

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getErrorType() {
        return errorType;
    }

    public void setErrorType(String errorType) {
        this.errorType = errorType;
    }

    public boolean isPrepared() {
        return prepared;
    }

    public void setPrepared(boolean prepared) {
        this.prepared = prepared;
    }

    public ArrayList<ParamValues> getParams() {
        return params;
    }

    public void setParams(ArrayList<ParamValues> params) {
        this.params = params;
    }

    public static class ParamValues {

        public int index;
        public Object value;

        public ParamValues(int index, Object value) {
            this.index = index;
            this.value = value;
        }
    }
}